home *** CD-ROM | disk | FTP | other *** search
- {$C-} { disable control char interpretation and thus user interupt }
-
- program MakeList;
-
- type
- filenametype = string[127];
- linetype = string[80];
-
- const
- ch : char = ' ';
- heading = 'Writing input list file: ';
- byebye = 'Program Makelist Terminated.';
- ExecQuestion = 'Do you wish to run Demo.Com (Y,N)?';
- ExecMessage = 'Executing Demo.Com';
- Title = 'MAKELIST INPUT LIST GENERATOR';
-
- var
- CmdLine : string[127] absolute cseg:$80; { address of command line }
- i,x,y,j,k,
- oldj,oldk : integer;
- filename,
- OldFilename,
- CmdParm : string[127];
- outfile : text;
- ExecFile : file;
-
- procedure CursorOff; { directly manipulates the CGA (color graphics card) }
- begin
- port[$3d4]:=10; { 6845 crt controller ind reg;points to reg to rec }
- port[$3d5]:=8; { data which is output to reg here;strt scan ln=8 }
- port[$3d4]:=11; { index to reg for cursor stop scan ln }
- port[$3d5]:=7; { stop scan line=7 }
- end;
-
- procedure CursorOn; { directly manipulates the CGA (color graphics card) }
- begin
- port[$3d4]:=10;
- port[$3d5]:=6; { start scan line = 6 ( normal ) }
- port[$3d4]:=11;
- port[$3d5]:=7; { stop scan line = 7 ( normal ) }
- end;
-
- function Center(str : linetype) : integer;
- begin
- Center := 39-round(length(str)/2)
- end;
-
- function Exist(filename: filenametype) : boolean;
- var
- tempfile : file;
- dummy : integer;
-
- begin
- assign(tempfile,filename);
- {$I-} { disable automatic generation of I/O checking code }
- reset(tempfile); { attempt to open file }
- Exist:=(IOresult=0); { standard function IOresult give 0 if no error }
- close(tempfile); { just in case the file exists, it must be closed or }
- dummy := IOresult; { end up with too many open files and prog. will abort }
- {$I+} { re-enable automatic generation of I/O checking code }
- end;
-
- procedure FixScreen; { prepare to end program }
- begin
- textmode(C80); { Reset color-text mode }
- textcolor(14); { I like bright yellow }
- textbackground(0); { and black background }
- clrscr;
- gotoxy(Center(byebye),12);
- cursoroff;
- write(byebye);
- delay(1000);
- gotoxy(1,24);
- cursoron;
- halt { End program }
- end;
-
- begin { makelist }
-
- j := 2000;
- k := 3;
- i := 0;
- clrscr;
- gotoxy(Center(Title),12);
- cursoroff;
- write(Title);
- delay(2500);
- clrscr;
- gotoxy(20,1);
- cursoron;
- write('Name of list file to create: ');
- x := wherex;
- y := wherey;
- read(filename);
- while filename = '' do
- begin
- gotoxy(x,y);
- read(filename)
- end;
- CmdParm := filename;
- assign(outfile,filename);
- rewrite(outfile);
-
- clrscr;
- gotoxy(Center(heading+filename),1);
- cursoroff;
- write(heading+filename);
- filename := '';
-
- repeat { input lines of list file and write to disk }
- i := i + 1;
- gotoxy(10,5);
- cursoroff;
- write('Picture file name # ');
- textcolor(11);
- write(i);
- textcolor(14);
- write(' (use no extension): ');
- clreol;
- textcolor(13);
- oldfilename := filename;
- x := wherex;
- y := wherey;
- cursoron;
- readln(filename);
- if filename = '' then
- begin
- cursoroff;
- filename := oldfilename;
- while filename = '' do
- begin
- gotoxy(x,y);
- cursoron;
- read(filename)
- end;
- gotoxy(x,y);
- cursoroff;
- write(filename);
- end;
- textcolor(14);
-
- gotoxy(10,7);
- cursoroff;
- write('Duration of display (milliseconds...1000 = 1 sec.): ');
- clreol;
- textcolor(13);
- oldj := j;
- j := -1;
- cursoron;
- read(j);
- if j < 0 then
- begin
- j := oldj;
- write(j)
- end;
- textcolor(14);
-
- gotoxy(10,9);
- cursoroff;
- write('Palette desired (0 to 3): ');
- clreol;
- textcolor(13);
- oldk := k;
- k := -1;
- cursoron;
- read(k);
- if k < 0 then
- begin
- k := oldk;
- write(k)
- end;
- textcolor(14);
-
- writeln(outfile,filename,' ',j,' ',k);
-
- gotoxy(10,13);
- textcolor(12);
- cursoroff;
- write('Hit <Enter> to continue, <Esc> to end.');
- textcolor(14);
-
- read(kbd,ch);
- while ch <> #13 do { <cr> = end program }
- if ch = #27 then { <esc> = try to run Demo.Com }
- begin
- close(outfile);
- clrscr;
- gotoxy(Center(ExecQuestion),12);
- cursoroff;
- write(ExecQuestion);
- ch := ' ';
- while not (upcase(ch) in ['Y','N']) do
- begin
- read(kbd,ch);
- if (Upcase(ch) = 'Y') and Exist('Demo.Com') then
- begin
- clrscr;
- CmdLine := CmdParm;
- gotoxy(Center(ExecMessage),12);
- cursoroff;
- write(ExecMessage);
- delay(1000);
- assign(ExecFile,'Demo.Com');
- execute(ExecFile)
- end
- end;
- FixScreen;
- end
- else
- read(kbd,ch);
- gotoxy(1,13);
- clreol
-
- until true = false
-
- end.